package com.ruoyi.project.test.gds.formal.controller;

import cn.hutool.core.util.IdUtil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/gds")
@CrossOrigin
public class IdProvideController {

    @GetMapping("/getSnowflakeId")
    public String getSnowflakeId(){
        synchronized (this) {
            return IdUtil.getSnowflake().nextIdStr();
        }
    }
    @GetMapping("/getNanoId")
    public String getNanoId(){
        return IdUtil.nanoId(10);
    }
    @GetMapping("/getUUID")
    public String getUUID(){
        return IdUtil.fastSimpleUUID();
    }
}
